Stop build script from rewriting README during cargo package#37
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| fn is_packaged_manifest(manifest_dir: &Path) -> bool { | ||
| let mut seen_target = false; | ||
| for component in manifest_dir.components() { | ||
| match component { | ||
| Component::Normal(name) => { | ||
| if seen_target && name == "package" { | ||
| return true; | ||
| } | ||
| seen_target = name == "target"; |
There was a problem hiding this comment.
[P1] Detect packaged builds without assuming default target dir
The new is_packaged_manifest helper only flags packaging when the manifest directory contains consecutive path components named target and package. cargo package indeed produces …/target/package/… by default, but when a user sets CARGO_TARGET_DIR to a custom directory (e.g., CARGO_TARGET_DIR=build on CI), the generated path becomes …/build/package/… and the function never sees a "target" component. In those setups the build script will continue to call sync_readme during packaging, rewriting files inside the package and re‑introducing the original failure. The detection needs to look for the package component irrespective of the parent directory or use an explicit environment signal from Cargo.
Useful? React with 👍 / 👎.
Summary
tempfilefor fixturesTesting
https://chatgpt.com/codex/tasks/task_e_68ca4a6d2940832b9aafec1856dd0419